******************************************
*
*	Article: The Human Costs of the War on Drugs: Attitudes towards Militarization of Security in Mexico
*	Authors: Juan Masullo J., Davide Morisi
*	Journal: Comparative Political Studies
*	Date: 23 March 2023
*
*	This file replicates the following
*	ANALYSIS OF STUDY 1 (APPENDIX A)
*
*	All analyses performed with Stata/SE 14.2 for Windows
******************************************

*Set working directory
*[my working directory]

*Open file
use "Replication_CPS\Data\study1_recoded.dta", clear


*Covariates
global demo_st1 "i.female i.agecat i.edu_uni trust_army01 i.city"


*
*Table A1. Summary statistics
ta agecat, gen(age_cat)
ta edu_uni, gen(edu_cat)
ta city, gen(city_cat)
ta group, gen(group_cat)
sum age, d
gen dv_att_control = dv_att if group==1
*table
eststo clear
estpost sum dv_att dv_att_control female age_cat* edu_cat* victim_cartel trust_army01 city_cat* group_cat*
esttab using "~TableA1.rtf", cells("count mean sd min max") replace
*drop created var
drop age_cat* edu_cat* city_cat* group_cat* dv_att_control

*
*Table A2. Balance tests
eststo clear
mlogit group $demo_st1 i.victim_cartel, b(1)
esttab using "~TableA2.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01) scalars (r2_a r2_p) title("TableA2. Study 1 - balance checks") compress noeqlines replace 

*
*Table A3. Average treatment effects
*Panel A
eststo clear
eststo: reg dv_att i.group
eststo: reg dv_att i.group $demo_st1 i.victim_cartel
eststo: reg dv_att i.group $demo_st1 i.victim_cartel if manip_check==1
esttab using "~TableA3_A.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01) scalars (r2_a r2_p) title("TableA3. Study 1 - Average treatment effects") wide compress noeqlines replace 
*Panel B - effects of info
eststo clear
reg dv_att ib2.group
eststo: margins, dydx(4.group 5.group) post 
reg dv_att ib2.group $demo_st1 i.victim_cartel
eststo: margins, dydx(4.group 5.group) post 
reg dv_att ib2.group $demo_st1 i.victim_cartel if manip_check==1
eststo: margins, dydx(4.group 5.group) post 
esttab using "~TableA3_B.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01) scalars (r2_a r2_p) title("Effects of arguments") wide compress noeqlines replace 

*Effects on standardized DV
*Panel A
eststo clear
reg st_dv_att i.group
eststo: margins, dydx(group) post
reg st_dv_att i.group $demo_st1 i.victim_cartel
eststo: margins, dydx(group) post
reg st_dv_att i.group $demo_st1 i.victim_cartel if manip_check==1
eststo: margins, dydx(group) post
esttab using "~TableA3_Ast.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01) scalars (r2_a r2_p) wide compress noeqlines replace 
*Panel B - info
eststo clear
reg st_dv_att ib2.group
eststo: margins, dydx(4.group 5.group) post 
reg st_dv_att ib2.group $demo_st1 i.victim_cartel
eststo: margins, dydx(4.group 5.group) post 
reg st_dv_att ib2.group $demo_st1 i.victim_cartel if manip_check==1
eststo: margins, dydx(4.group 5.group) post 
esttab using "~TableA3_Bst.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01) scalars (r2_a r2_p) wide compress noeqlines replace 


*
*Table A4. Interactions with self-reported victimization
eststo clear
eststo: reg dv_att i.group##i.victim_cartel
eststo: reg dv_att i.group##i.victim_cartel $demo_st1
esttab using "~TableA4.rtf", ///
b(%6.3f) se(%6.3f) starlevels(* .1 ** .05 *** .01)  scalars (r2) title("Interactions with victimization") wide compress noeqlines replace





